<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <%layout("/WEB-INF/view/common/inc/admin_head.html",{title:'', styles:'bootstrap,font-awesome,animate,style,bootstrap-table,layui-date,auto-complete,dtvalidate,layui,chosen'}){%>
    <style type="text/css">
        body{padding-top:10px;}
        *{margin:0;padding:0;list-style-type:none;}
        a,img{border:0;}
        .demo h2{font-size:16px;color:#3366cc;height:30px;}
        .demo li{float:left;}
        .has-no{color:#3366cc;}
        .has-success{color: #1ab394;}
        .has-warning{color: #f8ac59;}
        .has-error{color: #ed5565;}
        .has-receive{color: #9E792E;}
        .remark {
            width: 100%; /*自动适应父布局宽度*/
            overflow: auto;
            word-break: break-all;
        }
    </style>
    <%}%>
</head>

<body>
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins" style="margin-bottom: 0px;">
                <div class="ibox-content" style="padding:15px 20px 0px 20px;">
                    <form id="search-form" role="form" class="form-horizontal" autocomplete="off">
                        <div class="form-group">
                            <label class="control-label col-sm-1">Listing:</label>
                            <div class="col-sm-2">
                                <input type="text" id="listingName"  name="listingName"   class="form-control">
                            </div>
                            <label class="control-label col-sm-1">SKU:</label>
                            <div class="col-sm-2">
                                <input type="text" id="sku"  name="sku"   class="form-control">
                            </div>
                            <a class="search-btn btn btn-success" style="margin-bottom: 0px;">查询</a>
                        </div>

                    </form>
                </div>
            </div>

            <div id="toolbar" class="btn-group" style="margin-bottom:5px;">
                <button  class="import-v2-btn layui-btn layui-btn-sm import-btn" id="import-btn"  name="import-btn" style="margin-left: -2px"    >
                    <i class="layui-icon"></i>导入对应表
                </button>
                <button  class="layui-btn  layui-btn-sm" >
                    <i class="fa fa-download"></i>
                    <a href="/excel/V2对应表模板.xlsx" style="color: white" download>模板下载</a>
                </button>
            </div>
            <!-- START 数据表格 -->
            <table id="portTable"
                   data-toolbar="#toolbar"
                   data-side-pagination="server"
                   data-pagination="true"
                   data-resizable="true"
                   data-url="/sea/finance/vtRelated/findByCnd.do"
                   data-page-size="15"
                   class="table table-striped table-hover"
            >
            </table>
        </div>
    </div>
    <!-- END 数据表格 -->
</div>




<%layout("/WEB-INF/view/common/inc/admin_js.html",{modules:'jquery,bootstrap,bootstrap-table,dtvalidate,dtvalidate-lang-zh_cn,bootstrap-table-zh-CN,laydate,layer,chosen,chosen-demo,layui,upload'}){}%>
<script>
    layui.use('upload', function(){
        var upload = layui.upload;
        upload.render({
            elem: '#import-btn', //绑定元素,
            accept:'file',
            url: '/sea/finance/vtRelated/import/', //上传接口
            data:{},
            before:function () {
                layer.load(1, {
                    shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
            }
            ,done: function(data){
                if( data.ok ){
                    layer.msg(data.msg,{icon: 1,time: 1500},function(){
                        //刷新页面
                        $portTable.bootstrapTable('refresh');
                        layer.closeAll();
                    });
                }else{
                    layer.msg(data.msg,{icon: 0,time: 5000},function () {
                        layer.closeAll();
                    });

                }
            }
            ,error: function(){
                //请求异常回调
                layer.closeAll();
            }
        });
    });


    var $portTable = $('#portTable');
    $(function(){
        //START 表格配置
        $portTable.bootstrapTable({
            columns: [
                {
                    field: 'state',
                    checkbox: true,
                    align: 'center',
                    valign: 'middle'
                },
                {
                    title: 'Listing',
                    field: 'listingName',
                    align: 'center',
                    valign: 'middle'
                },
                {
                    title: 'SKU',
                    field: 'sku',
                    align: 'center',
                    valign: 'middle'
                },
                {
                    title: '所属国家',
                    field: 'countryName',
                    align: 'center',
                    valign: 'middle'
                }
            ],
            onLoadSuccess : function(){

            }
        });
        //操作菜单
    });

    $('.search-btn').on('click',function(){
        $portTable.bootstrapTable('refresh', { url:'${ctxPath}/sea/finance/vtRelated/findByCnd.do?'+$('#search-form').serialize() });
    });


</script>
</body>
</html>
